home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / comm / mail / YAM23src.lha / Source / extrasrc / stccpy.c < prev    next >
C/C++ Source or Header  |  2000-12-15  |  296b  |  14 lines

  1. #include "extra.h"
  2.  
  3. /* Copy the q to the n chars buffer pointed by p.
  4.    The result is null terminated.
  5.    Returns the number of copied bytes, including '\0'. */
  6.  
  7. int stccpy(char *p, const char *q, int n)
  8. {
  9.    char *t = p;
  10.    while ((*p++ = *q++) && --n > 0);
  11.    p[-1] = '\0';
  12.    return p - t;
  13. }
  14.